DECLARE @Id INT;
SELECT @Id = id
FROM sysobjects
WHERE name = 'Sahmiyeh';
IF NOT EXISTS
(
    SELECT *
    FROM syscolumns
    WHERE id = @Id
          AND name = 'PISCode'
)
    ALTER TABLE Sahmiyeh ADD PISCode VARCHAR(10);

IF NOT EXISTS
(
    SELECT *
    FROM syscolumns
    WHERE id = @Id
          AND name = 'PISCodeType'
)
    ALTER TABLE Sahmiyeh ADD PISCodeType TINYINT;


SELECT @Id = id
FROM sysobjects
WHERE name = 'PISReceivedPrescription';
IF NOT EXISTS
(
    SELECT *
    FROM syscolumns
    WHERE id = @Id
          AND name = 'SpecialtyCode'
)
    ALTER TABLE PISReceivedPrescription ADD SpecialtyCode VARCHAR(10);
