Можете да опитате да използвате UNPIVOT по този начин...
SELECT empid, empvalues
FROM (
select empid, addr, convert(varchar(100), sal) as sal, convert(varchar(100), doj, 103) as doj
from emp
) pv
UNPIVOT
(
empvalues
FOR ev in (addr, sal, doj)
) AS ev
създава този резултат...
Ресурси за справка...
https://codingsight.com/understanding-pivot-unpivot- and-reverse-pivot-statements/ https://docs.microsoft.com/en-us/sql/t-sql/queries/from-using-pivot-and-unpivot?view=sql-server-ver15