DECLARE @Id Int                                                     
Select @Id = Id From sysobjects Where Name = 'TmpDrugHavaleh'
IF not Exists(SELECT * FROM syscolumns WHERE id = @Id and Name = 'TypeOfMedicine')
  Alter Table TmpDrugHavaleh Add TypeOfMedicine TINYINT DEFAULT(0);


Select @Id = Id From sysobjects Where Name = 'DrugHavaleh'
IF not Exists(SELECT * FROM syscolumns WHERE id = @Id and Name = 'TypeOfMedicine')
  Alter Table DrugHavaleh Add TypeOfMedicine TINYINT DEFAULT(0);

Select @Id = Id From sysobjects Where Name = 'RepNoskheh'
IF not Exists(SELECT * FROM syscolumns WHERE id = @Id and Name = 'TrackingCode')
  Alter Table RepNoskheh Add TrackingCode VARCHAR(20);

Select @Id = Id From sysobjects Where Name = 'RepNoskheh'
IF not Exists(SELECT * FROM syscolumns WHERE id = @Id and Name = 'SequenceNumber')
  Alter Table RepNoskheh Add SequenceNumber SMALLINT DEFAULT(0);
  
Select @Id = Id From sysobjects Where Name = 'RepNoskheh'
IF not Exists(SELECT * FROM syscolumns WHERE id = @Id and Name = 'Nezam_No')
  Alter Table RepNoskheh Add Nezam_No VARCHAR(10);