Each Pokemon species grants between 1 and 3 EVs when defeated. Everything that gets EXP also gets EVs in full, including when the EXP share is active, when the Pokemon was fighting the enemy but switched out, and when the Pokemon is captured (in the sixth gen), but not when the Pokemon is knocked out. EVs are not split; everything that can get them gets all of them. The level of the defeated Pokemon doesn't matter, only its species.
Does that mean: 1) When I capture a legendary (ie: Yveltal), will the pokemon I had in battle (ie: Breloom) gains 3 HP EV?
2) Will this Yveltal ever gain EVs while I am capturing it? What I mean is, if Yveltal knocks out my lead pokemon (ie: Breloom) in battle, I send another pokemon in and I capture Yveltal, will Yveltal gain 2 Att EVs from knocking out my Breloom?
I'm sure the latter questions are not true and the captured pokemon remains "untouched". Just confirming this information.