I remember the first girl I ever talked to, who I think was pretty attractive, was this girl I knew in high school. I remember the day I almost decided I was going to try to talk to her, since it was hardly something that came natural (and still isn't). She had sat next to me in senior English, and said to me "I didn't think I had any friends in this class!"
My first thought was "Crap!" as this painted me into a corner. Usually at that time of my life I just didn't talk to anyone, as I just assumed they wouldn't want to, and thought anything to do with me would be horrible for them. This girl, who I had never said more than a couple words to though, decided we were friends. If I didn't make an honest effort to communicate, I would have felt like a very shit person, and it would have been a very long semester.
So my brain starts moving it's cogs after that. I see it first as an opportunity to work on getting out of my shell, to get comfortable with girls. I had to make it seem less scary in my head though, otherwise I would always be tense, nervous and on edge like you were.
And that's what my brain did.
See first I knew, or thought she was, dating someone who I was friends with. So that took dating off the table completely. Not that it really ever was, but just by being able to eliminate it so completely just took a huge weight off my chest. I don't have to worry about any of that stuff. And in doing that, it took away the attractiveness. Don't get me wrong, I still found her attractive. But being unavailable make her feel like a sister, or more accurately, your friends girlfriend.
And so my advice to you is next time you see an attractive girl, imagine her as someone you don't have a chance with. Not in a self-loathing way, like you're not good enough, but that for some reason, like she's dating your best friend, you guys can never be together.
For me honestly, it helped. And it turned out later she had broken up with the guy and was actually talking to an available girl the whole time, just the idea of her not being was what helped. And then into talking to a girl I had a crush on, all from that initial idea that she was just a practice talker, someone to help me get comfortable. And I had the same experience online. I talked to people freely thinking I would never meet them, never date them, that they would never see me and weren't any more than words on a screen. Two years later All of a sudden I realized I was talking to actual people, in a normal way, without worrying. Just because I didn't think about what I was doing. It ended up in a relationship for me, and all because it's something I never thought would happen.
So overly long post short, next time you see a hot girl, don't think "HOT GIRL." instead think of her in a different way. Whatever helps you relax. For me it was thinking nothing will ever happen. It might not be that for you, but hopefully there's something that works.