How to get custom values outside Loop

<?php
global $wp_query;
$postid = $wp_query->post->ID;
echo get_post_meta($postid, 'Your-Custom-Field', true);
wp_reset_query();
?>

Example:

<?php 
global $wp_query;
$postid = $wp_query->post->ID;
$img = get_post_meta($postid, 'sidebar_image', true);
if($img)
{
echo "<img src ='$img'>";
}
else{
?>
<img src="<?php bloginfo("template_url")?>/images/care.jpg" />
<?php
}
wp_reset_query();
?>