insert into test1
select 'Payroll1' as [Payroll],'State tax'as Tax, 100 as [Total Tax]
union all
select 'Payroll1' as [Payroll] ,'Fed tax'as Tax, 300 as [Total Tax]
union all
select 'Payroll2' as [Payroll],'State tax'as Tax, 110 as [Total Tax]
union all
select 'Payroll2' as [Payroll],'Fed tax'as Tax, 302 as [Total Tax]
--select * from test1
select
Payroll
,[State tax]
,[Fed tax]
from(
select * from test1 ) p pivot (
sum([Total Tax]) for [Tax] in
(
[State tax]
,[Fed tax]))
m