Opiate use during pregnancy can cause a lot of issues; premature birth, placenta detachment, even fetal death. I know you're scared, but you need help. This isn't going to be easy, but you need to come clean with your doctor, and you also need to get some support for staying clean. Are you going to meetings, or do you have a therapist or both? Using a drug even though you know the outcome is BAD is the hallmark of addiction. Fact is, you are an active addict and without a program of treatment and plan for recovery, you're at high risk of doing this again.
I get it; you're scared, but we aren't talking about just your life anymore; you're got a whole person growing inside you that deserves the best chance at life you can give it; so take a deep breath and be a responsible mother; TELL your doctor, along with these words "please help me; I want to stay sober." You can do this; I hope you post again.
Anything taken during the 2nd trimester can show up. If i was you i would talk to your OB and tell them what you told us. It is always better to be safe than sorry. Is this your 1st baby?