Я не уверен, поможет ли это или нет, но кажется, что UNPIVOT стоит посмотреть. Возвращает значения столбцов в виде разных строк.
declare @t table(c1 int, c2 int, c3 int, c4 int, c5 int)
insert into @t(c1,c2,c3,c4,c5) values (1,2,null, null, 5)
select cols, col
from (select c1,c2,c3,c4,c5 from @t) p
unpivot (cols for col in (c1,c2,c3,c4,c5)) as unpvt
Возвращает:
cols col
----------- ---------
1 c1
2 c2
5 c5