DECLARE @Id Int                               
SELECT @Id = Id From sysobjects Where Name = 'History_Detail_Factors'
IF not Exists(SELECT * FROM syscolumns WHERE id = @Id and Name = 'TransactionType')
  Alter Table History_Detail_Factors Add TransactionType TINYINT DEFAULT(0) NOT Null