

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[sel_idae_tablas]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[sel_idae_tablas]
GO
CREATE PROCEDURE [dbo].[sel_idae_tablas]
	@p_filtro as varchar (8000) = '1=1',
    @p_tabla as varchar(1000)='[_tablas]',
    @p_campos as varchar(8000)=' * '
AS
BEGIN
exec(	'SELECT '+ @p_campos +'	FROM '+  @p_tabla +' WHERE ' + @p_filtro)
END
