See the following for how to use CrossTabs and Pivots.
http://www.sqlservercentral.com/articles/T-SQL/63681/
See the following for how to make the CrossTabs dynamic.
http://www.sqlservercentral.com/articles/Crosstab/65048/
--Jeff Moden
Change is inevitable... Change for the better is not.