Detect count of columns for plans automatically