I ran into performance issues caused by parameter sniffing so many times using this type of construct
at work that I had to stop using it.
Now I use this:
declare @local_firstname nvarchar(50)
declare @local_lastname nvarchar(50)
select @local_firstname = isnull(@firstname,''), @local_lastname = isnull(@lastname,'')
SELECT ID, FirstName, LastName FROM People
WHERE
FirstName LIKE '%' + @local_firstname + '%'
and
LastName LIKE '%' + @local_lastname + '%'
It's more work up front but:
a) makes the query easier to understand (and therefore maintain) and
b) avoids slow queries caused by the use of inappropriate query plans via parameter sniffing
Just my 2c