-- =============================================
-- Create procedure basic template
-- =============================================
-- creating the store procedure
IF EXISTS (SELECT name
FROM sysobjects
WHERE name = N'proc_test'
AND type = 'P')
DROP PROCEDURE proc_test
GO
CREATE PROCEDURE proc_test
@tablename nvarchar,
@where nvarchar
AS
exec (N'SELECT * from '+@tablename+@where)
GO
-- =============================================
-- example to execute the store procedure
-- =============================================
EXECUTE proc_test 'test',' where id >1'
GO