DECLARE @Id INT;
SELECT @Id = id
FROM sysobjects
WHERE name = 'CorrectionHistory';
IF NOT EXISTS
(
    SELECT *
    FROM syscolumns
    WHERE id = @Id
          AND name = 'PrePrescriptionId'
)
    ALTER TABLE CorrectionHistory ADD PrePrescriptionId NUMERIC(19, 0) NULL;