Solicitors and Barristers do not "Come up with a defence to try and get a not guilty verdict" I practiced as a defence solicitor for 23 years and during that period dealt with many high profile cases including 4 murders.
Lawyers take instructions from their clients about their version of the events that have happened. Sometimes they say that they committed the offence; sometimes they are responsible for the actions but not the offence e.g. acted in self-defence and sometimes they have an explanation that amounts to a defence - for example an alibi. If the client tells their lawyer that they committed the offence but intend to put forward a false account to the court then the lawyer has to decline instructions and ask them to seek alternative representation.
On occasions a client will put forward a version of events that is frankly ridiculous or seems very unlikely to be acceptable to the court e.g. saying they bought stolen goods in all honesty but refusing to disclose the source. In these cases the legal team will ask the client to consider that their defence is not likely to succeed and suggest that they fully consider the reduction in penalty that an early guilty plea brings.
Out of my 4 murder cases - all of which attracted a lot of local ( and in one case national) publicity -two were found to be self-defence, in one case the accused was supposed to have murdered a baby but in fact scientific evidence proved that the death took place at a different time to that the prosecution witnesses alleged and he could not have been responsible ( murderer was most probably the mother's drug dealer). In the last case the client put forward a very implausible version of events and was convicted. We had a professional duty to put forward his defence but we are only human and felt that the result was just.
As I was a solicitor I dealt with many hundreds of cases during my career and there are instances of false accusations, misunderstandings and sadly incompetent or worse policing. Several of my clients who were found not guilty went on to make claims against the police and gain compensation. Some who were not charged or who were found guilty also made claims because of brutal treatment in custody.
It is a measure of a civilised society that no matter how abhorrent the charge if you are in trouble you will get fair minded representation and a lawyer who will listen and assist you through the complexities of the legal system without pre-judging you or treating you with a lack of respect.