What I have posted isn't Dynamic SQL... it's a hardcoded query like you might have in any stored procedure but it's necessarily stored in a string simply because that's what OPENQUERY requires. I know that OPENROWSET doesn't allow the use of variables and must be dynamic to make changes but I haven't actually tried using a variable with OPENQUERY so I don't know if "simple" query replacement would work here or not. Of course, "full" dynamic SQL like that used for making changes to an OPENROWSET would work but I absolutely understand the desire to avoid such a thing.
--Jeff Moden
Change is inevitable... Change for the better is not.