Flipping True or False values to save typing and time
I'd replace the if-then-elses with DBGrid1.Columns[i].Visible := not DBGrid1.Columns[i].Visible - i.e. use the not keyword instead of your Flip function.

And you probably can store references to the relevant columns in an array, TList or similar. Then you don't need to loop all columns and check their names.