select * from (select name, ID from Empoyee) Visits pivot(sum(ID) for name in ([Emp1], [Emp2], [Emp3] ) ) as pivottable;