Hi Richard
In these sort of situations, there are three things you need to do :-
1.Accept responsibility for your own actions - eg not blaming the drink for your behaviour / not blaming your ex for the neglect, etc.
2. Understand why you behaved this way, and decide what your priorities are - eg getting back at ex / avoiding prison.... or being a positive influence & role model in your baby's life.
3. Have a clear plan for how you are going to avoid repeating this behaviour and convince Social Services (and the Court ?) that you can put the plan into action.
It sounds like you will need outside help to do these things and verify if there is a genuine change in your attitude, rather than just you paying lip service for your own ends.
It will not be easy and require will humility & persistence, but I certainly know men who have turned things round for their own and their children's sake.
There are plenty services to help, but you have to do some big thinking about where your priorities lie.
Recognising you have a problem is the first step - I wish you all the very best !
R