 <p>Build your query like this:</p> <pre><code> string query = string.empty query += "select "; if (CheckBoxList1[0].Selected) { query += "first_column, "; }//and so on query += " from tblProject"; </code></pre>