Point of reference: I am very new to sql so if it is something obvious...
Also i removed the guts of the sp (too long and irrelevant)

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[TABLE1]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
BEGIN

CREATE PROCEDURE isp_calc_totals
.........
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

END