You never show us where @model_look_xm is actually declared. I assume it must be because you state it actually works. However, the most likely issue is your local variable is not accessible in your dynamic sql statement. You have to pass it as a parameter if order for you to access it.

To solve simply define @model_look_xm as a input parameter on your dynamic statement.