InfoPath doesn't support dynamic columns. If you will have the same number of columns, but with different data in them, you could use different expression boxes for the headings, showing and hiding the right one based on the user's filter. But if you sometimes need to see more columns than others, you'll just have to make sure you have all the columns you need and add multiple table controls to the form, bound to the same table, showing / hiding as needed. Also - if you are querying a secondary data source and then want it in a repeating table bound to the main data source, you'll need to write code for that.
Hilary Stoupa
