Potresti provare a usare UNPIVOT, in questo modo...
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
produce questo output...
Risorse di riferimento...
https://codingsight.com/understanding-pivot-unpivot- e-dichiarazioni-reverse-pivot/ https://docs.microsoft.com/en-us/sql/t-sql/queries/from-using-pivot-and-unpivot?view=sql-server-ver15