
IF NOT EXISTS (SELECT TOP 1 CD_EMP FROM PG_FORN_INTEGRACAO) 		
	BEGIN 
		IF NOT OBJECT_ID('EST_PED_CP_PARAM') IS NULL
			BEGIN
				IF EXISTS (SELECT TOP 1 CD_EMP FROM EST_PED_CP_PARAM)
					BEGIN
						RETURN
					END
			END
	
		IF NOT OBJECT_ID('EST_PED_ELTR_ATIVA_CP_HIST_PARAM') IS NULL 
			BEGIN 
				DROP TABLE EST_PED_ELTR_ATIVA_CP_HIST_PARAM
			END
		
		IF NOT OBJECT_ID('EST_PED_ELTR_ATIVA_CP_HIST_ORD_DEFAULT') IS NULL 
			BEGIN 		
				DROP TABLE EST_PED_ELTR_ATIVA_CP_HIST_ORD_DEFAULT
			END
		
		IF NOT OBJECT_ID('EST_PED_ELTR_ATIVA_CP_HIST_MCP') IS NULL 
			BEGIN 				
				DROP TABLE EST_PED_ELTR_ATIVA_CP_HIST_MCP
			END
			
		IF NOT OBJECT_ID('EST_PED_ELTR_ATIVA_CP_HIST') IS NULL 
			BEGIN 				
				DROP TABLE EST_PED_ELTR_ATIVA_CP_HIST
			END
			
		IF NOT OBJECT_ID('EST_PED_ELTR_ATIVA_CP_EST_PED_ELTR') IS NULL 
			BEGIN 				
				DROP TABLE EST_PED_ELTR_ATIVA_CP_EST_PED_ELTR
			END
			
		IF NOT OBJECT_ID('EST_PED_ELTR_ATIVA_CP_EST_PED_CP_ROTEIRO_CP') IS NULL 
			BEGIN 				
				DROP TABLE EST_PED_ELTR_ATIVA_CP_EST_PED_CP_ROTEIRO_CP
			END

		IF NOT OBJECT_ID('EST_PED_CP_ROTEIRO_CP_HIST_MCP_EST_PED_ELTR_ATIVA_CP') IS NULL
			BEGIN
				DROP TABLE EST_PED_CP_ROTEIRO_CP_HIST_MCP_EST_PED_ELTR_ATIVA_CP
			END
		
		IF NOT OBJECT_ID('EST_PED_CP_ROTEIRO_CP_HIST_PARAM_EST_PED_ELTR_ATIVA_CP') IS NULL
			BEGIN 
				DROP TABLE EST_PED_CP_ROTEIRO_CP_HIST_PARAM_EST_PED_ELTR_ATIVA_CP
			END
			
		IF NOT OBJECT_ID('EST_PED_ELTR_ATIVA_CP') IS NULL 
			BEGIN 				
				DROP TABLE EST_PED_ELTR_ATIVA_CP
			END
			
		IF NOT OBJECT_ID('EST_PED_ELTR_FORN_CTR_ENV_PG_FORN_INTEGRACAO_ARQ_PENDENTE') IS NULL 
			BEGIN 		
				DROP TABLE EST_PED_ELTR_FORN_CTR_ENV_PG_FORN_INTEGRACAO_ARQ_PENDENTE
			END
			
		IF NOT OBJECT_ID('PG_FORN_INTEGRACAO_ARQ_PENDENTE') IS NULL 
			BEGIN 					
				DROP TABLE PG_FORN_INTEGRACAO_ARQ_PENDENTE
			END 
			
		IF NOT OBJECT_ID('EST_PED_CP_ROTEIRO_CP_EST_PED_CP_PARAM') IS NULL 
			BEGIN 					
				DROP TABLE EST_PED_CP_ROTEIRO_CP_EST_PED_CP_PARAM
			END

		IF NOT OBJECT_ID('EST_PED_CP_ROTEIRO_CP_AGD_SEMANA') IS NULL 
			BEGIN 					
				DROP TABLE EST_PED_CP_ROTEIRO_CP_AGD_SEMANA
			END
		
		IF NOT OBJECT_ID('EST_PED_CP_ROTEIRO_CP_HIST_MCP') IS NULL
			BEGIN
				DROP TABLE EST_PED_CP_ROTEIRO_CP_HIST_MCP
			END
		
		IF NOT OBJECT_ID('EST_PED_CP_ROTEIRO_CP_HIST_PARAM') IS NULL
			BEGIN
				DROP TABLE EST_PED_CP_ROTEIRO_CP_HIST_PARAM
			END
			
		IF NOT OBJECT_ID('EST_PED_CP_ROTEIRO_CP') IS NULL 
			BEGIN 					
				DROP TABLE EST_PED_CP_ROTEIRO_CP
			END 

		IF NOT OBJECT_ID('EST_PED_CP_PARAM_PRC_FILIAL') IS NULL 
			BEGIN 					
				DROP TABLE EST_PED_CP_PARAM_PRC_FILIAL
			END
			
		IF NOT OBJECT_ID('EST_PED_CP_PARAM_PG_FORN_INTEGRACAO') IS NULL 
			BEGIN 					
				DROP TABLE EST_PED_CP_PARAM_PG_FORN_INTEGRACAO
			END 

		IF NOT OBJECT_ID('EST_PED_CP_PARAM_EST_PROD_FABRIC') IS NULL 
			BEGIN 					
				DROP TABLE EST_PED_CP_PARAM_EST_PROD_FABRIC
			END
			
		IF NOT OBJECT_ID('EST_PED_CP_PARAM_EST_PROD') IS NULL 
			BEGIN 					
				DROP TABLE EST_PED_CP_PARAM_EST_PROD
			END 

		IF NOT OBJECT_ID('EST_PED_CP_PARAM_EST_ARV_MERC_LINHA') IS NULL 
			BEGIN 						
				DROP TABLE EST_PED_CP_PARAM_EST_ARV_MERC_LINHA
			END
			
		IF NOT OBJECT_ID('EST_PED_CP_PARAM') IS NULL 
			BEGIN 					
				DROP TABLE EST_PED_CP_PARAM
			END 
		
		IF NOT OBJECT_ID('EST_PED_CP_PG_FORN_ORD_DEFAULT') IS NULL 
			BEGIN 
				DROP TABLE EST_PED_CP_PG_FORN_ORD_DEFAULT
			END 
	END