Puedes aplicar directamente unpivot sobre las columnas y realizar la operación. Create Table #temp (c1 int, c2 int, c3 int, c4 int, c5 int, c6 int, c7 int, c8 int, c9 int, c10 int); Insert into #temp (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10) values (85,10,25,87,69,22,90,89,96,50), (54,50,90,88,30,91,5,46,37,44), (30,10,24,53,8,11,1,16,80,61), (44,1,20,66,4,7,62,88,70,57), (65,50,100,50,97,18,90,27,46,75); Sobre ese conjunto de datos. Select upv.columna, sum(upv.valor) as valor from #temp unpivot (valor for columna in (c2,c4,c6,c8,c10))upv group by upv.columna; [![Result][1]][1] [1]: https://i.sstatic.net/qDPDN.png