<p>How do you create SQL Server 2005 stored procedure templates in SQL Server 2005 Management Studio?</p>

[{'answer_id': 64995, 'author': 'Jorge Ferreira', 'author_id': 6508, 'author_profile': 'https://Stackoverflow.com/users/6508', 'pm_score': 2, 'selected': False, 'text': '<p>You bring up <em>Template Explorer</em> using Ctrl+Alt+T or trough <em>View > Template Explorer</em>. Then you can right click tree nodes to add new Templates or new folders to organize your new templates.</p>\n'}, {'answer_id': 64997, 'author': 'Chris Woodruff', 'author_id': 7001, 'author_profile': 'https://Stackoverflow.com/users/7001', 'pm_score': 5, 'selected': True, 'text': '<p>Another little nugget that I think will help people developing and being more productive in their database development.  I am a fan of stored procedures and functions when I develop software solutions.  I like my actual CRUD methods to be implemented at the database level.  It allows me to balance out my work between the application software (business logic and data access) and the database itself.  Not wanting to start a religious war, but I want to allow people to develop stored procedures more quickly and with best practices through templates.</p>\n\n<p>Let’s start with making your own templates in the SQL Server 2005 management Studio.  First, you need to show the Template Explorer in the Studio.</p>\n\n<p><a href="http://www.cloudsocket.com/images/image-thumb10.png" rel="nofollow noreferrer">alt text http://www.cloudsocket.com/images/image-thumb10.png</a></p>\n\n<p>This will show the following:</p>\n\n<p><a href="http://www.cloudsocket.com/images/image-thumb11.png" rel="nofollow noreferrer">alt text http://www.cloudsocket.com/images/image-thumb11.png</a></p>\n\n<p><a href="http://www.cloudsocket.com/images/image-thumb12.png" rel="nofollow noreferrer">alt text http://www.cloudsocket.com/images/image-thumb12.png</a></p>\n\n<p><a href="http://www.cloudsocket.com/images/image-thumb13.png" rel="nofollow noreferrer">alt text http://www.cloudsocket.com/images/image-thumb13.png</a></p>\n\n<p>The IDE will create a blank template.  To edit the template, right click on the template and select Edit.  You will get a blank Query window in the IDE.  You can now insert your template implementation.  I have here the template of the new stored procedure to include a TRY CATCH.  I like to include error handling in my stored procedures.  With the new TRY CATCH addition to TSQL in SQL Server 2005, we should try to use this powerful exception handling mechanism through our code including database code.  Save the template and you are all ready to use your new template for stored procedure creation.</p>\n\n<pre><code>-- ======================================================\n-- Create basic stored procedure template with TRY CATCH\n-- ======================================================\n\nSET ANSI_NULLS ON\nGO\nSET QUOTED_IDENTIFIER ON\nGO\n-- =============================================\n-- Author:        &lt;Author,,Name&gt;\n-- Create date: &lt;Create Date,,&gt;\n-- Description:    &lt;Description,,&gt;\n-- =============================================\nCREATE PROCEDURE &lt;Procedure_Name, sysname, ProcedureName&gt;\n    -- Add the parameters for the stored procedure here\n    &lt;@Param1, sysname, @p1&gt; &lt;Datatype_For_Param1, , int&gt; = &lt;Default_Value_For_Param1, , 0&gt;,\n    &lt;@Param2, sysname, @p2&gt; &lt;Datatype_For_Param2, , int&gt; = &lt;Default_Value_For_Param2, , 0&gt;\nAS\n    BEGIN TRY\n        BEGIN TRANSACTION    -- Start the transaction\n\n        SELECT @p1, @p2\n\n        -- If we reach here, success!\n        COMMIT\n    END TRY\n    BEGIN CATCH\n        -- there was an error\n        IF @@TRANCOUNT &gt; 0\n        ROLLBACK\n\n        -- Raise an error with the details of the exception\n        DECLARE @ErrMsg nvarchar(4000), @ErrSeverity int\n        SELECT @ErrMsg = ERROR_MESSAGE(), @ErrSeverity = ERROR_SEVERITY()\n\n        RAISERROR(@ErrMsg, @ErrSeverity, 1)\n    END CATCH\nGO\n</code></pre>\n'}, {'answer_id': 4149000, 'author': 'Dhiraj', 'author_id': 489194, 'author_profile': 'https://Stackoverflow.com/users/489194', 'pm_score': 2, 'selected': False, 'text': '<p>Database=>Table=>Programmability=>Procedures=>Right Clik Select New procedures</p>\n'}]
['https://Stackoverflow.com/questions/64977', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/7001/']