To create a script
As you type, an event class is generated in the upper pane.
Note To replay a Transact-SQL script, the first Transact-SQL statement must be USE database, where database is the name of the database against which the script is to run.
Creating and Replaying SQL Scripts