Redirect 301 /viewstory.php?sid=20449 https://mynewdomain/works/12345
The mod_alias Redirect directive matches against the URL-path only, not the query string. To match this URL you would need to use mod_rewrite and check the QUERY_STRING server variable in a condition. For example:
RewriteEngine On
RewriteCond %{QUERY_STRING} ^sid=20449$
RewriteRule ^viewstory\.php$ https://mynewdomain/works/12345 [QSD,R=301,L]
The QSD flag is necessary to discard the original query string from the redirect response.
I'd like to put together a giant .htaccess file with all the redirects.
This may be OK if this is all you are using the old host for... redirecting to the new site on a different server/virtualhost. Although, how many individual redirects do you have?
However, ordinarily, if you are maintaining old and new sites on the same server/virtualhost then it is more efficient to implement 100s (or 1000s) of redirects in your application, rather than .htaccess (or even the server config). And only when your application has deemed the request would result in a 404. This is to ensure that normal site visitors are not impacted in any way by the redirect logic (.htaccess is processed on every single request).
Alternatively, you internally rewrite (in ./htaccess) all requests of the form /viewstory.php?sid=<something> to a separate script and that script handles the redirects.
For example:
RewriteEngine On
# Rewrite all requests of the form "/viewstory.php?sid=<something>" to a PHP script
RewriteCond %{QUERY_STRING} ^sid=.
RewriteRule ^viewstory\.php$ manage-old-redirects.php [L]
In the above we internally rewrite (no redirect) all requests of the form /viewstory.php?sid=<something> to your PHP script /manage-old-redirects.php, in which you perform the necessary lookups to construct the redirect as required.