Added sql query to remove template pages