To execute a .sql file, you need to open the “Query Analyzer”
Start -> Programs -> MS SQL Server -> Query Analyzer
Connect to the database that you’re running the script on.
Then open the SQL file using File -> Open
Once it is open, you can execute the file by pressing F5.