USE [Database] IF OBJECT_ID('[Procedures].[insert_attribute]', 'P') IS NOT NULL DROP PROCEDURE [Procedures].[insert_attribute]; GO CREATE PROCEDURE [Procedures].[insert_attribute] @name AS NVARCHAR(128), @inserted_attribute_id AS INT = NULL OUTPUT AS BEGIN TRANSACTION; INSERT INTO [Tables].[attributes]([name]) VALUES (@name); SET @inserted_attribute_id = SCOPE_IDENTITY(); COMMIT TRANSACTION; GO