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


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


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