IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Tmp_Over_Under_Row_Drug_TmpDrugHavaleh]') AND parent_object_id = OBJECT_ID(N'[dbo].[Tmp_Over_Under_Row_Drug]'))
ALTER TABLE [dbo].[Tmp_Over_Under_Row_Drug] DROP CONSTRAINT [FK_Tmp_Over_Under_Row_Drug_TmpDrugHavaleh]

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Tmp_Over_Under_Row_Drug]') AND type IN (N'U'))
DROP TABLE [dbo].[Tmp_Over_Under_Row_Drug]

IF Exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Over_Under_Row_DrugHavaleh]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Over_Under_Row] DROP CONSTRAINT FK_Over_Under_Row_DrugHavaleh

IF Exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Tmp_Over_Under_Row_TmpDrugHavaleh]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Tmp_Over_Under_Row] DROP CONSTRAINT FK_Tmp_Over_Under_Row_TmpDrugHavaleh

IF EXISTS ( SELECT * FROM  dbo.sysobjects WHERE   id = OBJECT_ID(N'[dbo].[Sodor_Factor_Drug]') AND OBJECTPROPERTY(id, N'IsProcedure') = 1 )
  DROP PROCEDURE [dbo].[Sodor_Factor_Drug];



