USE [Database]

IF OBJECT_ID('[Procedures].[insert_price_history_record]', 'P') IS NOT NULL
  DROP PROCEDURE [Procedures].[insert_price_history_record];
GO
CREATE PROCEDURE [Procedures].[insert_price_history_record]
  @product_id AS INT,
  @datetime   AS DATETIME,
  @price      AS MONEY,
  @inserted_price_history_record_id INT = NULL OUTPUT
AS
  BEGIN TRANSACTION;
    INSERT INTO [Tables].[price_history_records]([product_id], [datetime], [price])
    VALUES (@product_id, @datetime, @price);
    SET @inserted_price_history_record_id = SCOPE_IDENTITY();
  COMMIT TRANSACTION;
GO