How can I add search condition to SQL Stored Procedure programmatically? In my application(C#) I\'m using stored procedure (SQL Server 2008R2)
ALTER PROCEDUR
you could have your procedure as string, and send a string with the conditions, concatenate and exec.
ALTER PROCEDURE [dbo].[PROC001] @userID varchar(20), @password varchar(20), @WhereToAdd varchar(MAX) AS
exec ('SELECT * FROM tUsers WHERE RTRIM(Name) = @userID AND RTRIM(Password) = @password AND ' + @WhereToAdd)