I know this topic is everywhere but I couldn\'t get it to work properly. It\'s probably something very simple.
Here is a sample of the data after a basic query:
From your query
PIVOT ( max(Model) FOR Site in ' + @cols + ') ) AS piv
you should use the column Count in MAX() function and Model in FOR...IN section. this is because your new values will be the Count and your new columns will be from the values in Model
Count
MAX()
Model
FOR...IN