IF EXISTS (SELECT *
           FROM   sys.objects
           WHERE  object_id = OBJECT_ID(N'[dbo].[GetAccountPaidByMedicalAidAmount]')
                  AND type IN ( N'FN', N'IF', N'TF', N'FS', N'FT' ))
  DROP FUNCTION [dbo].[GetAccountPaidByMedicalAidAmount]



IF EXISTS ( SELECT * 
            FROM   sysobjects 
            WHERE  id = object_id(N'[dbo].[sp_GetMedicalAidInvoices]') 
                   and OBJECTPROPERTY(id, N'IsProcedure') = 1 )
    DROP PROCEDURE [dbo].[sp_GetMedicalAidInvoices]



IF EXISTS ( SELECT * 
            FROM   sysobjects 
            WHERE  id = object_id(N'[dbo].[sp_DebtorsAgeReportResult]') 
                   and OBJECTPROPERTY(id, N'IsProcedure') = 1 )
    DROP PROCEDURE [dbo].[sp_DebtorsAgeReportResult]



IF EXISTS ( SELECT * 
            FROM   sys.views 
            WHERE  name='pal_vCreditListing' and type='v')
BEGIN
    DROP VIEW [dbo].[pal_vCreditListing]
END



IF EXISTS ( SELECT * 
            FROM   sys.views 
            WHERE  name='pal_vDebitListing' and type='v')
BEGIN
    DROP VIEW [dbo].[pal_vDebitListing]
END



IF EXISTS ( SELECT * 
            FROM   sys.views 
            WHERE  name='pal_vInvoiceListing' and type='v')
BEGIN
    DROP VIEW [dbo].[pal_vInvoiceListing]
END



IF EXISTS ( SELECT * 
            FROM   sys.views 
            WHERE  name='pal_vReceiptListing' and type='v')
BEGIN
    DROP VIEW [dbo].[pal_vReceiptListing]
END



IF EXISTS ( SELECT * 
            FROM   sysobjects 
            WHERE  id = object_id(N'[dbo].[sp_ReconByFiscalPeriod]') 
                   and OBJECTPROPERTY(id, N'IsProcedure') = 1 )
    DROP PROCEDURE [dbo].[sp_ReconByFiscalPeriod]


IF EXISTS ( SELECT * 
            FROM   sysobjects 
            WHERE  id = object_id(N'[dbo].[sp_CampaignLogExport]') 
                   and OBJECTPROPERTY(id, N'IsProcedure') = 1 )
    DROP PROCEDURE [dbo].[sp_CampaignLogExport]
