• The only way to do it is to make it as dynamic SQL. Notice that this will cause concerns about security (permissions issues and SQL injection). If you'll write a little bit more about your problem, maybe someone here will be able to offer you a better design.

    Adi

    --------------------------------------------------------------
    To know how to ask questions and increase the chances of getting asnwers:
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    For better answers on performance questions, click on the following...
    http://www.sqlservercentral.com/articles/SQLServerCentral/66909/