title: How to merge two stored procedures
body: <p>I have two stored procedures one for INSERT and second for Update and I'd like to merge them in one so could you please tell me which satement should I use for that ? </p>
  
  <pre><code>CREATE PROCEDURE Tools
  (@CategoryID_1 int,
   @CategoryName_2 nvarchar(100),
   @Description_3 ntext)
  
  AS INSERT INTO Categories 
   (CategoryID,
   CategoryName,
   Description) 
  
  VALUES 
  (@CategoryID_1,
   @CategoryName_2,
   @Description_3)
  </code></pre>
  
  <p>go</p>
  
  <pre><code>CREATE PROCEDURE Tools1
  
       (@CategoryID_1     [int],
   @CategoryID_2  [int],
   @CategoryName_3    [nvarchar](50),
   @Description_4     [ntext],
  
  AS UPDATE [Teachdb].[dbo].[Categories] 
  
  SET  [CategoryID]    = @CategoryID_2,
   [CategoryName]  = @CategoryName_3,
   [Description]   = @Description_4,
  
  WHERE 
  ( [CategoryID]   = @CategoryID_1)
  go
  </code></pre>
  
  <p>GO</p>