Declare @Id Int
Select @Id = Id From sysobjects Where Name = 'Over_Under_Factor_Drug'
if not Exists(SELECT * FROM syscolumns WHERE id = @Id  and Name = 'Over_Del_Flag')
ALTER TABLE Over_Under_Factor_Drug ADD  Over_Del_Flag  Char(1) Default(1) Null


Select @Id = Id From sysobjects Where Name = 'Over_Under_Factor_Drug'
if not Exists(SELECT * FROM syscolumns WHERE id = @Id  and Name = 'Over_Row_No')
ALTER TABLE Over_Under_Factor_Drug ADD  Over_Row_No  int Default(0) Null



if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[sp_Auto_Calc_Rows_Over]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[sp_Auto_Calc_Rows_Over]


if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[sp_UpdateRow_Over]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[sp_UpdateRow_Over]




