declare @tabla table(codlibro int,fecha_pub datetime)
insert into @tabla values(1,GETDATE()),(2,getdate()),(3,GETDATE()+1),(4,GETDATE()+1),(5,GETDATE()+2)
select fecha_pub,codlibro from @tabla
select fecha_pub, [1],[2],[3],[4],[5]
from
(select fecha_pub,codlibro from @tabla) as PV
pivot
(
sum(codlibro)
for codlibro IN ([1],[2],[3],[4],[5])
)as PA