To get that we have to follow these steps.
1. In the Object Explorer go to view -- > Template Explorer
2. There are several templates to use in.
3. Right click on Sql Server Templates and Add New Folder
4. Right clieck on Folder and Add new Template
5. Set the Name of the Template and then click edit for write you sql
6. Write your query there like
Select * from information_schema.tables where table_name = 'abc'
7. Run this query and save the template.
8. Open it again in edit mode and this time apply following changes.
Select * from information_schema.tables where table_name = '
9. Save and close the Template window
10. Now open the Template agin by duble click on the file.
11. go to Query -- > Specify Values for Template Parameter
13. Enter value of parameter and see how Template work for several conditions.
Here are some Sample Pictures.
Picture1 : Template explorer with New Template file and folder