IF NOT EXISTS (SELECT * FROM sys.columns WHERE  object_id = OBJECT_ID(N'[dbo].[AuditAttachment]') AND name = 'ChecklistQuestionID')
ALTER TABLE [dbo].AuditAttachment
ADD ChecklistQuestionID int
GO

ALTER PROCEDURE [dbo].[InsertNewAuditAttachment]
	-- Add the parameters for the stored procedure here
	@Key uniqueidentifier,
	@AuditAttachmentID int,
	@AuditKey uniqueidentifier,
	@Name nvarchar(200),
	@ChecklistQuestionID int
AS
BEGIN
	Insert into AuditAttachment
	([Key],  AuditKey, AuditAttachmentID, AttachmentName, ChecklistQuestionID)
	Values
	(@Key, @AuditKey, @AuditAttachmentID, @Name, @ChecklistQuestionID)
	
	SELECT [Key] from AuditAttachment
	WHERE [Key] = @Key
END