Awe poor guy.
So, am I reading right that he has NEVER lived in a home type environment? He has always been in a cage/crate? And you've only had him for 4 months? You may not like what I'm going to say, but, hopefully it will offer a glimmer of light at the end of the tunnel.
For his sad situation I'd say you've got a ways to go yet. The good news is that he's ONLY been with you for 4 months. For most typical dogs you can expect that it takes a good month to adjust to a new home. But for a rescue, an older puppy mill rescue at that, one who I assume was intact this whole time as well (?), that has never lived in a home with a family, you should expect to put AT LEAST 6 months into rehabilitating this dog.
And it sounds like he no doubt has separation anxiety. If he's never had the opportunity to bond with people he is probably so confused about why you're coming and going. He doesn't know what a normal relationship is all about.
My first suggestion is to a hire a good trainer. Better yet, a board certified veterinary behaviorist. Be wary of trainers who call themselves behaviorists. Which ever, have someone come into your home and observe his behavior, then help you to formulate a plan. He really needs one-on-one behavior modification and not an obedience training type of class. The socialization of the latter would probably not do any harm, but the former is important as he sounds like a very confused little guy that really needs to learn what most pups learn in their first 3-4 months of life. He's WAY behind!
For the potty training, you really need to throw out any and all expectations that you may have and start over. Pretend he's a brand new baby puppy. Even forgot the last 4 months. Start over.
Invest in some sort of unbelievably tasty treats, or a super motivating toy. I haven't met a dog that doesn't go bananas for a microwaved hot dog sliver.
Buy an egg timer.
First thing in the morning clip him up and take him out to pee/poop and REWARD, REWARD, REWARD. Give him the hot dog as soon as he's done. (If you haven't started him with a clicker, I highly recommend it. For him he might do really well with the instant reward that the clicker offers.)
Bring him inside and set the egg timer for 30 minutes. Normally I'd say 1 hour, but if you can dedicate a weekend to this, I would try to aim for 30 minutes and really make an impression.
Keep him on a leash in the house, and keep him with you at all times. If you can keep some of the hot dogs in your pocket and randomly reward him for calm and settling behavior this might help you two fold - for the pottying and the separation anxiety. ONLY reward him if he settles unprompted by you. For example, if you sit down at the computer and he lays down at your feet, reward. Don't say anything, just wait for him to settle and then reward.
When the timer goes off clip him up and take him out. Give him 2 or 3 minutes to go, and if he does, reward, reward, reward.
As for the crate, since he has absolutely no concept of going to the bathroom outside, you're going to have to start out with really short amounts of time in the crate. Start with 15 minutes. When he comes out of the crate, immediately take him out for a pee. If he pees, reward like crazy and then play with him for a bit. If he doesn't pee, put him back in the crate and wait 5-10 minutes and try again. Repeat until he goes to the bathroom. When he does, REWARD REWARD REWARD. I also suggest you feed him in the crate, and work on making the crate a fun place to be.
Unlike potty training a puppy, you have to break the habit of peeing indoors or in his crate. He has been doing this for 4 years. Going inside is what he knows to be right. You not only have to teach him to go where YOU want him to go, but you have to implement a preemptive strike element here and get to him before he does what is normal to
him, which is eliminating inside or in his crate. Breaking a 4 year long habit is far harder than teaching a new puppy that doesn't know one way or another and just goes wherever because it has to go.
Basically, you have to take HUGE steps to set him up for success. If you take him outside, on a leash, as often as physically possible, and you reward him each and every time, he'll start to think that one way is a whole lot better than the other. You have to make going outside more motivating that going inside. Not only does rewarding him help move toward that goal, but the biggest key here is going to be PREVENTING him from going inside (thus, setting him for rewards, and the more he gets rewarded, the more he'll work to
get rewarded). He needs 100% supervision. Frequent trips outside. And acclimating him to the crate (pretty much in the same manner as housebreaking him - frequent trips outside, reward, don't leave him long at a time).
Leaving him in the crate while you work is going to be the biggest set back. Can you hire a dog walker for a couple of weeks? If you can dedicate a good week or two and REALLY stick with a strict, strict schedule, you can do it. Otherwise you'll go two steps forward and one step back until he gets it.
For the seperation anxiety, if you work with a BCVB they could help you find a med that might bridge the gap between the work you'll do with behavior modification and his adjustment period. SSRI's (fluoexetine, aka, prozac, is commonly used with dogs), and with non aggression related anxiety even valium is sometimes used.
Not all dogs need to be on, or are candidates for, medication. Work with someone qualified to make that judgment.
The single best thing you can do is demonstrate normality, eliminate emotional ups and downs, and reward the behavior you want while trying to ignore the behavior you don't want.
It sounds like he's quite bonded to you, which means he's going to look to you for cues on how to respond to the stimuli in his environment. It's REALLY important for you to respond to him and what's going on in the way you want
him to respond. Essentially you're going to model the behavior you want.
Also keep in mind that dogs don't speak our language, so to them attention is attention is attention. When they're nervous and stressed they'll pick up inflections, and when you're nervous, he'll get nervous. Plus, having a conversation with a dog is more meaningful to us than them. Don't get me wrong, dogs respond a whole lot to verbal commonucation, but that's because we're giving them attention. Saying
words is a human thing. Saying things like "hi puppy, I'm home", or "be good, mommy's going to work now", are a form of giving the dog attention.
When a dog is nervous and anxious that you're leaving, and you give it attention, ie; say things like "mommy is going to work now, be good", we're giving them attention, thus rewarding them. It's in our nature to be nurturing and reassuring. When we see them act stressed or scared, we want to reassure them that everything will be Ok, and for humans, we do that verbally. But when I said to model the behavior you want, if you want calm, relaxed, confident behavior, then you must act that way. Preferably non verbally.
Nurturing and reassuring verbal communication from humans is probably the worst thing you can do for an anxious dog. They sense that something is wrong, but they don't understand that what you're reassuring is actually their behavior, and when a dog senses something is wrong and YOU aren't handling it, they feel compelled to do something about it themselves. And when a nervous dog decides it must "take action", you have a recipe for disaster.
The skittish behavior has to be a non-issue. You HAVE to ignore it. If you acknowledge it, it will never stop. Acknowledging it confirms it's something that is worthy of time and energy.
And then of course, exercise, exercise, exercise. A tired dog is a peaceful dog.
I think a behaviorist is your best bet. And time. And consistency.