I know I can change the number format for columns through the designer but can I do it through scripting as my columns are going to be dynamically change based on my sample definition.
Yes, you can dynamically generate the column attributes dataset that drives the table's formatting. Via script, typically.