title: How to make a stored procedure return the last inserted id
body: <p>Here I have a stored procedure that inserts a row but how do you make it return the last inserted id without making another query</p>
  
  <pre><code>CREATE PROCEDURE [dbo].[spInsertCriteriaItem]
  @GroupID int
  AS
  BEGIN
      -- SET NOCOUNT ON added to prevent extra result sets from
      -- interfering with SELECT statements.
      SET NOCOUNT ON;
  
      insert into CriteriaItem (CriteriaGroupID) VALUES(@GroupID)
      --I don't want to make another query here
  END
  </code></pre>
  
  <p>Is it possible to do this</p>