From the Super Mario Wiki
Climbing Koopas are Koopa Troopas that climb fences. They are found in Super Mario World, New Super Mario Bros., New Super Mario Bros. Wii and New Super Mario Bros. 2. They are also seen in the Yoshi series.
In Super Mario World, Climbing Koopas are found in castles and come in two colors: green and red. The green variety moves slowly while the red variety is as fast as Mario and Luigi. They move in one direction, either horizontal or vertical. When they reach the edge of the fence, they will flip to the opposite side of the fence. They can be easily killed by fireballs, punches from the opposite side of the fence, or simply having the player be on top of the Koopa as it passes by.