How to set column header dynamically

Is there a way to get the column header value fetched from a table dynamically ? For example, the grid has column names col1, col2 and there is another table which has same column names col1, col2. But this table has the values for the grid col1, col2. I’ve setup the association but I do not see a way to let the setHeader method to fetch the values from the associated table