Cologne have automatic promotion to the Bundesliga in their own hands, after Florian Kainz scored twice in a comeback win at Nuremberg.