That problem is probably related to the Recycle Bin module, if you delete a page and it goes to the Recycle Bin module, the relation between the page and its template persists.
As a quick fix you can permanent delete those pages that does not allow you to delete the template.
If you're not using RB module, can you please provide us with more information about the problem like are these pages in multilingual / multisite mode and when you click on the template counter do you see the name of the pages there like here
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal
and vote to affect the priority of the items