When you say it runs fast if you declare the parameter variable and run the sql manually, but takes ages when you run it through BIDS I think of parameter sniffing.
Try declare a variable in your SP, then the first thing you do is assign the value of your parameter to this new local variable, then use the local variable everywhere in your SP.
For more info :http://blogs.technet.com/b/mdegre/archive/2012/03/19/what-is-parameter-sniffing.aspx