If your binary value is in string (as SA asked), below code will help you:
int i = Convert.ToInt32("000101010101", 2);
here 2 (second parameter) denotes the base of the first parameter (base for binary would be 2). For further help you can read the
MSDN documentation for this method.
For Sql Server have a look at
this link. This UDF works well when supplied digits only (in the input string) except the case when you want hexadecimal conversion, so take care of that in your calling code.
Hope that helps!