Du kan prova att använda UNPIVOT, så här...
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
producerar denna utdata...
Resurser för din referens...
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