I didn't use SQL Server for a decade, but that's how the resulting query would look in in MySQL:
select Category, sum(if(Agegroup='2-4',1,0)), sum(if(Agegroup='7-9',1,0)), sum(if(Agegroup='9-11',1,0))
from dbo.model
group by Category;
Try the following resulting SQL in SQL server, and if it gives you the correct data, you "just" will have to do it dynamic...
But maybe there is better fix using the 'pivot' function form SQL Server?