There is a slight problem with the code being provided to you. But as Eimantas suggested, you could simply make a new file called category-39.php which will accomplish the job perfectly, if though for some reason you are still wanting to continue using your category.php file, then here is what you would need to do:
if ( is_category('39') ) {
get_sidebar('2');
} else {
get_sidebar();
}
?>
<?php get_footer(); ?>
The difference between this and the code that you posted is that I have removed
<?php get_sidebar(); ?>
Additionally I have changed in_category to is_category. The reason for this is because when looking at the category page itself using is_category will change on the category list, whereas in_category only looks at the current post and therefore will not change according except when looking at the single.php page.
Example:
in_category will change the sidebar for the following url www.mysite.com/category/stuff/myfirstpost
But it will not change the sidebar for this url www.mysite.com/category/stuff
Simply using is_category will fix this problem.
The next thing would be using
get_sidebar('2');
and
get_sidebar();
get_sidebar(); will run the appropriate wordpress functions related to the sidebar in addition to including sidebar.php.
get_sidebar('2'); on the other hand will run all the appropriate wordpresss functions related to the sidebar while also loading sidebar-2.php.
Hope this helps,