I have this problems pretty often... What I do is that I record a lot of things even when Im only practising at home to my DAW (Ableton, Bitwig, Reaper - the last one is available for download for free, Ableton is free for 3 month like a trial, but you can find more daws) - you can eliminate this unbelievable kind of panic at least a little and your brain will some come to terms with the fact that you're recorded and you won't even think about it after some time, recording will become your every day reality and you won't be afraid to go to a professional recording studio so much or whatever - what is ideal to practice is to play with: 1. metronome, 2. drum track, 3. backing track without voice, 4. full backing track - but I know that it is hard to have it so... Back to the point! it is only in the head and very often it is only because of a low self confidence, hidden feeling that you didnt practice enough somewhere deep inside your brain or so and thats why the block occurs in the head... Ive learnt such a fine thing during singing that helps me also during playing the guitar - always find everything about the song you're learning, understand the lyrics, understand what is the song about, why it was written and then fully feel the emotions, feel that you are the person telling the story behind the song and youre telling it with the guitar... your brain will be relaxed and concentrated on something else, you will start to feel the song as one whole piece, each note will fit to each other and the block will be away... If you have problem with concentrating to wake up the emotions, close your eyes and just listen
) Mainly stop being afraid of anything... Fear is the worst enemy for each musician
... Hope my speech helped you at least a little
)