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