if not exists(select * from INFORMATION_SCHEMA.tables 
			 where table_name='EST_RPS_IT') 
begin
    /****** Object:  Table [dbo].[EST_RPS_IT]    Script Date: 25/09/2017 11:39:58 ******/
    SET ANSI_NULLS ON
    SET QUOTED_IDENTIFIER ON

    CREATE TABLE [dbo].[EST_RPS_IT](
	    [ID] [bigint] IDENTITY(1,1) NOT NULL,
	    [RPS_ID] [bigint] NOT NULL,
	    [CD_CNAE] [int] NULL,
	    [CD_TRIB_MUNICIPIO] [int] NULL,
	    [DESC_SERVICO] [varchar](100) NULL,
	    [VLR_ISS_RETIDO] [money] NULL,
	    [ITEM_LISTA_SERVICO] [varchar](100) NULL,
	    [CD_MUN_INCIDENCIA] [int] NULL,
	    [QTD_SERV] [int] NULL,
	    [SERIE_PRESTACAO] [int] NULL,
	    [SERV_TRIBUTAVEL] [int] NULL,
	    [TP_RECOLHIMENTO] [int] NULL,
	    [VLR_DESCONTO] [money] NULL,
	    [VLR_TOTAL] [money] NULL,
	    [VLR_UNITARIO] [money] NULL,
	    [CD_PROD] [int] NULL,
	CONSTRAINT [PK_EST_RPS_IT] PRIMARY KEY CLUSTERED 
    (
	    [ID] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    ALTER TABLE [dbo].[EST_RPS_IT]  WITH CHECK ADD  CONSTRAINT [FK_EST_RPS_IT_EST_RPS] FOREIGN KEY([RPS_ID])
    REFERENCES [dbo].[EST_RPS] ([ID])
    ALTER TABLE [dbo].[EST_RPS_IT] CHECK CONSTRAINT [FK_EST_RPS_IT_EST_RPS]
end

