We have this UNPIVOT query.
SELECT Value
FROM (Your select statement) as x
UNPIVOT (Value FOR val IN (a, b, c, d)) as p
That produces results like this:
Value
value1
value2
value3
value4
How can we elaborate to include the column names?
Value ColumnName
value1 a
value2 b
value3 c
value4 d