How to manage the table component of a report when column number can change at runtime

This approach is probably the best you can do:

TL/DR:

Reporting tables cannot have variable numbers or columns, nor variable column names. You can fake it to a certain extent by hiding columns and using other variables for the column names in the table header. Consider using a script data source to transform any given dataset to have the needed column names while populating the variables for the column headers from that given dataset. And hiding the unused columns.

Good luck.