If this is an internal company application why is everyone re-iterating and beating SQL Injection to death... Its very simple to just use Dynamic SQL.
If you are comfortable that these are only internal users using this then its very simple. Here is the concept. You essentially write a SQL Statement that writes a string that is really a SQL statement and then execute it.
CREATE Procedure myDynamicProcedure
@strDept nvarchar(10),
@strUser nvarchar(30)
as
BEGIN
1. Declare a variable to store the SQL Statement.
DECLARE @SQL varchar(max)
2. SET your @SQL Variable to be the SELECT Statement. Basically you are building it so it returns what you are wanting to write. Like this:
SET @SQL = 'select x, y, z from table1 where' + @strDept +
' in ' + @strUser
3. Execute the @SQL Statement and it will be exactly like you ran:
SELECT x,y,z from table1 where f18 = 'Ted Lee'
EXEC (@SQL)
END