There is no "automatically succeed stealth check" -- stealth checks are opposed by perception checks. So that's out.
Let's see how it would work in general. Here are some rules from the stealth skill:
Breaking Stealth When you start your turn using Stealth, you can leave cover or concealment and remain unobserved as long as you succeed at a Stealth check and end your turn in cover or concealment. Your Stealth immediately ends after you make an attack roll, whether or not the attack is successful (except when sniping as noted below).
Okay, so you're starting and ending your turn with cover or concealment (in this case, it sounds like cover, fwiw). Good. Let's check the sniping rules.
If you've already successfully used Stealth at least 10 feet from your target, you can make one ranged attack and then immediately use Stealth again. You take a –20 penalty on your Stealth check to maintain your obscured location.
So you're able to make a stealth check, because you have cover. But it will be at a penalty (after all, you just shot someone, so they have a pretty good clue where you are). If your stealth check is higher than their perception check, though, you are still stealthed, and will still treat them as flatfooted next round.