in sql server create dynamic query to create columns for example
declare @NoOFcolumns int=5
select name, [Col1], [col2], [col3], [col4], [col5]
from
(
select c.name,
cr.description,
r.typeid
from customers c
left join rewards r
on c.id = r.customerid
left join customerrewards cr
on r.typeid = cr.typeid
) x
pivot
(
count(typeid)
for description in ([Col1], [col2], [col3], [col4], [col5])
) p;
then add 5 columns
for eaxmple @NoOFcolumns int=10 how to add 10 columns by default