I have the following dynamic query which is working fine without the WHERE clause, which is expecting UNIQUEIDENTIFIER.
WHERE
UNIQUEIDENTIFIER
When I pass it in,
I'm not sure if your variable is getting populated in string format or binary, but you may need to quote the uniqueidentifier in your where clause. If you just select the uniqueidentifier field, does it come back as string or binary?