OnMove and OnSort dbgadv

I need help with moving and sorting columns. I use example.
I`ve got table with  3 columns: prod_name, prod_count, prod_color
my query is something like: select prod_name, prod_count, prod_color from prod_table

now i want to sort grid without moving columns. Everything is ok but if i move column prod_count ( 2-nd column ) before prod_name ( 1-st column ) and click column title to sort it, i still use the order from select statement - so 1st is prod_name.
How can I move column and sort with correct fild name?