Это также будет работать
DECLARE @tble TABLE (id INT, maths INT, phy INT, chem INT)
INSERT INTO @tble VALUES
(1,50,60,21),(2,60,80,22),(3,80,90,23);
select * from(
SELECT ID,maths AS Scores, 'maths' as Subjects FROM @tble
UNION
SELECT ID,phy AS Scores, 'phy' as Subjects FROM @tble
UNION
SELECT ID,chem AS Scores, 'chem' as Subjects FROM @tble
) s
PIVOT
(
MIN(Scores)
FOR id IN ([1], [2], [3])
) piv