A Flip-flopper (U-turn in the UK) is used to describe someone who frequently changes their opinions. It's often used to describe politicians who change their stances to go with the current popular sentiment.
Someone who wavers on their opinions and can't make up their mind is said to be vacillating or indecisive.
A person who changes loyalty based on whether or not something is succeeding is refereedreferred to as fair-weather - particularly the fair-weather fan when speaking about a sports team supporter.