• Another way to generate procedures, that many people don't take advantage of, is to use the Templates offered by SSMS. If you click on the View menu and then Template Explorer, or hit Ctl-Alt-T, you'll see a window open with a whole bunch of folders. Scroll down to Store Procedures and open it. You'll see several options for creating procedures, including the "Create Stored Procedure (New Menu)" option, which is what you get when you bring up the context menu by right clicking on the Procedures folder in a database. Opening any of these will show you a template for creating a procedure. Make sure that you're in the correct database before running this code. If you hit Ctl-Shift-M you'll get a window that will allow you to replace the embedded parameters so that you can name your procedure and all the rest. It's also possible to create your own templates, so you can put error handling routines & other internal standards into a template and then use it.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning